package com.castte.game.snake;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;

public class SnakeMain extends Activity {
	GameCanvas _gamecanvas;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// super.onCreate(savedInstanceState);
		// setContentView(R.layout.main);
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		_gamecanvas = new GameCanvas(this);
		setContentView(_gamecanvas);
	}
	
	public void onPause(){
		super.onPause();
		ExitActivity();
	}
	
	public boolean onKeyDown(int keyCode, KeyEvent msg) {
		return _gamecanvas.onKeyDown(keyCode, msg);
	}
//	public boolean onKeyUp(int keyCode, KeyEvent msg) {
//		return _gamecanvas.onKeyUp(keyCode, msg);
//	}
	public void ExitActivity(){
		if(_gamecanvas!=null)
			_gamecanvas=null;
		finish();
	}
}